package site.teamo.biu.net.server.pojo.dto;

import cn.hutool.core.bean.BeanUtil;
import lombok.Data;
import lombok.experimental.Accessors;
import site.teamo.biu.net.common.constant.YesOrNo;
import site.teamo.biu.net.server.entity.ClientDO;

import java.util.Date;

/**
 * @@author: 爱做梦的锤子
 * @date: 2023/3/26 16:03
 */

@Data
@Accessors(chain = true)
public class ClientDTO {
    private String clientId;

    private String name;

    private String token;

    private YesOrNo httpHttpsProxyServiceOnline;

    private Date createTime;

    private Date updateTime;

    public static ClientDTO from(ClientDO clientDO, boolean httpHttpsProxyServiceOnline) {
        ClientDTO clientDTO = new ClientDTO();
        BeanUtil.copyProperties(clientDO, clientDTO);
        clientDTO.setHttpHttpsProxyServiceOnline(YesOrNo.of(httpHttpsProxyServiceOnline));
        return clientDTO;
    }
}
